import request from '@/utils/request'

export function getRecruits(data, offset, limit) {
  return request({
    url: '/recruit',
    method: 'get',
    params: {
      title: data.title,
      positionId: data.positionId,
      form: data.form,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}

export function getMyRecruit(data, offset, limit) {
  return request({
    url: '/recruit/mine',
    method: 'get',
    params: {
      title: data.title,
      positionId: data.positionId,
      form: data.form,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}

export function addRecruit(data) {
  return request({
    url: '/recruit',
    method: 'post',
    data
  })
}

export function modifyRecruit(id, data) {
  return request({
    url: `/recruit/${id}`,
    method: 'put',
    data
  })
}

export function modifyRecruitStatus(id, status) {
  return request({
    url: `/recruit/status/${id}?status=${status}`,
    method: 'put'
  })
}
